﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

using LuckyBingoRcon.Commands.Events;

namespace LuckyBingoRcon.Commands
{
	public class KickBanCommand : Command
	{
		public EventHandler<KickBanCommandEventArgs> OnResponse;

        // Take note of the space after the commmand
        public KickBanCommand(int option)
        {
            switch(option)
            {
                case 1:
                    base.commandText = "clientkick ";
                    break;
                case 2:
                    base.commandText = "tempbanclient ";
                    break;
                case 3:
                    base.commandText = "banclient ";
                    break;
                default:
                    base.commandText = "clientkick ";
                        break;
            }

            base.args = null;
        }

		protected override void CommandOnResponse(string response)
        {
            // This should be write-only.
        }

        public override string ToString()
        {
            string action;
            switch (base.commandText)
            {
                case "clientkick":
                    action = "Kicking";
                    break;
                case "tempbanclient":
                    action = "Temporarily Banning";
                    break;
                case "banclient":
                    action = "Banning";
                    break;
                default:
                    action = "Kicking";
                    break;
            }
            if (base.args.Length.Equals(2))
                return action + "\t" + base.args[0] + "\treason\t" + base.args[1];
            else if (base.args.Length.Equals(3))
                return action + "\t" + base.args[0] + "\tfor\t" + base.args[1] + " minutes\treason\t" + base.args[2];
            else
                return action + "\t" + base.args[0];
        }
	}
}
